<%--
  Created by IntelliJ IDEA.
  User: lxm
  Date: 2018/5/4
  Time: 下午3:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <jsp:include page="/static/common/stylesheets.jsp"></jsp:include>
    <link href="/static/layui/css/doc.css" rel="stylesheet">
    <title>单文本分词</title>
    <style>
        p {
            font-size: 16px;
            line-height: 2;
        }

        .icon {
            position: relative;
            font-size: 15px;
            height: 32px;
            display: block;
            fill: rgba(51, 51, 51, 0.5);
            margin-right: 20px;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        .icon.active {
            fill: #E74C3C;
        }

        .icon.big {
            width: 64px;
            height: 64px;
            fill: rgba(51, 51, 51, 0.5);
        }

        #wrapper {
            min-height: 700px;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: auto;
            background-color: #fff;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: left;
            -webkit-justify-content: left;
            -ms-flex-pack: left;
            justify-content: left;

        }

        #left-side {
            height: 70%;
            width: 15%;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
        }

        #left-side ul li {
            padding-top: 10px;
            padding-bottom: 10px;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            line-height: 34px;
            color: rgba(51, 51, 51, 0.5);
            font-weight: 500;
            cursor: pointer;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        #left-side ul li:hover {
            color: #333333;
            -webkit-transition: all .2s ease-out;
            transition: all .2s ease-out;
        }

        #left-side ul li:hover > .icon {
            fill: #333;
        }

        #left-side ul li.active {
            color: #333333;
        }

        #left-side ul li.active:hover > .icon {
            fill: #E74C3C;
        }

        #border {
            height: 600px;
            width: 1px;
            background-color: rgba(51, 51, 51, 0.2);
        }

        #border #line {
            width: 5px;
            height: 54px;
            background-color: #E74C3C;
            margin-left: -2px;
            margin-top: 7px;
            -webkit-transition: all .4s ease-in-out;
            transition: all .4s ease-in-out;
        }

        #right-side {
            /*height: 300px;*/
            min-height: 650px;
            width: 85%;
            /*overflow: hidden;*/
        }

        #right-side #first, #right-side #second, #right-side #third, #right-side #fourth {
            position: absolute;
            height: 300px;
            width: 75%;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
            margin-top: -350px;
            opacity: 0;
            display: -webkit-box;
            display: -webkit-flex;
            display: -ms-flexbox;
            display: flex;
            -webkit-box-align: center;
            -webkit-align-items: center;
            -ms-flex-align: center;
            align-items: center;
            -webkit-box-pack: center;
            -webkit-justify-content: center;
            -ms-flex-pack: center;
            justify-content: center;
            -webkit-box-orient: vertical;
            -webkit-box-direction: normal;
            -webkit-flex-direction: column;
            -ms-flex-direction: column;
            flex-direction: column;
        }

        #right-side #first.active, #right-side #second.active, #right-side #third.active, #right-side #fourth.active {
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }

        .tab-active {
            color: #333333;
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }

        .tab-content-active {
            margin-top: 0px;
            opacity: 1;
            -webkit-transition: all .6s ease-in-out;
            transition: all .6s ease-in-out;
        }
    </style>
</head>
<body>
<jsp:include page="/static/common/header.jsp"></jsp:include>

<div class="layui-main site-inline">
    <jsp:include page="/static/common/docs.jsp"></jsp:include>

    <div class="site-content">
        <h1 class="site-h1">API - 综述</h1>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本平台使用RESTful API的形式对外提供服务。REST全称是Representational State
            Transfer，中文意思是表述性状态转移。 它首次出现在2000年Roy Fielding的博士论文中，Roy
            Fielding是HTTP规范的主要编写者之一。REST本身并没有创造新的技术、组件或服务，而隐藏在RESTful背后的理念就是使用Web的现有特征和能力， 更好地使用现有Web标准中的一些准则和约束。
        </p>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">HTTP 方法</a></legend>
        </fieldset>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本自然语言处理与可视化平台，尽可能地依靠标准的 HTTP 动词和 REST 约定设计接口，如下：
        </p>
        <table>
            <thead>
            <tr>
                <th style="text-align:center;">动词</th>
                <th style="text-align:left;">用途</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td style="text-align:center;">GET</td>
                <td style="text-align:left;"> 从服务器取出资源（一项或多项）。</td>
            </tr>
            <tr>
                <td style="text-align:center;">POST</td>
                <td style="text-align:left;"> 在服务器新建一个资源。</td>
            </tr>
            <tr>
                <td style="text-align:center;">PUT</td>
                <td style="text-align:left;"> 在服务器更新资源（客户端提供改变后的完整资源）。</td>
            </tr>
            <tr>
                <td style="text-align:center;"> DELETE</td>
                <td style="text-align:left;"> 从服务器删除资源。</td>
            </tr>
            </tbody>
        </table>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">响应状态码</a></legend>
        </fieldset>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;本自然语言处理与可视化平台并不依赖标准的HTTP响应码来标注返回状态，而是自定义了一套格式化的状态码来标识此刻资源或者服务器的状态。如下
        </p>
        <table>
            <thead>
            <tr>
                <th style="text-align:center;">状态码</th>
                <th style="text-align:left;">含义</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td style="text-align:center;">0</td>
                <td style="text-align:left;">成功，数据请求中没有发生任何异常</td>
            </tr>
            <tr>
                <td style="text-align:center;">100</td>
                <td style="text-align:left;">参数丢失，在请求过程中，如果用户发送的请求缺少参数。</td>
            </tr>
            <tr>
                <td style="text-align:center;">101</td>
                <td style="text-align:left;">参数格式错误。</td>
            </tr>
            <tr>
                <td style="text-align:center;">102</td>
                <td style="text-align:left;">参数为空，区别于参数丢失，102表示用户确实输入了空的参数，如 ""</td>
            </tr>
            <tr>
                <td style="text-align:center;">103</td>
                <td style="text-align:left;">参数不可信任，如遇到参数签名不一致的问题。</td>
            </tr>
            <tr>
                <td style="text-align:center;">200</td>
                <td style="text-align:left;">用户名/密码不正确</td>
            </tr>
            <tr>
                <td style="text-align:center;">201</td>
                <td style="text-align:left;">用户名不存在</td>
            </tr>
            <tr>
                <td style="text-align:center;">202</td>
                <td style="text-align:left;">用户名已被锁定</td>
            </tr>
            <tr>
                <td style="text-align:center;">301</td>
                <td style="text-align:left;">该服务资源没有找到</td>
            </tr>
            <tr>
                <td style="text-align:center;">400</td>
                <td style="text-align:left;">客户端使用了错误的请求方式，如接收POST、但是客户端GET</td>
            </tr>
            <tr>
                <td style="text-align:center;">403</td>
                <td style="text-align:left;">不允许访问的内容，用户没有权限访问</td>
            </tr>
            <tr>
                <td style="text-align:center;">404</td>
                <td style="text-align:left;">其它资源未找到</td>
            </tr>
            <tr>
                <td style="text-align:center;">999</td>
                <td style="text-align:left;">系统内部错误，提示系统繁忙，请稍后再试。</td>
            </tr>
            </tbody>
        </table>
        <fieldset class="layui-elem-field layui-field-title site-title">
            <legend><a name="compatibility">格式化返回</a></legend>
        </fieldset>
        <p>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;为了用户能够统一解析的函数，故本平台HTTP返回格式统一如下：
        </p>
        <pre style="    height: 200px;" class="md-fences md-end-block" lang="json"> <div
                class="CodeMirror cm-s-inner CodeMirror-wrap"><div
                style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 4px;"></div><div
                class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler"
                                                                                     cm-not-content="true"></div><div
                class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer"
                                                             style="margin-left: 0px; margin-bottom: 0px; border-right-width: 30px; padding-right: 0px; padding-bottom: 0px;"><div
                style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div
                role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"></div><div
                class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div
                class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline"
                                                                          style="position: relative;"><div
                class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div
                class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;">{</span></pre></div><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;</span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span
                class="cm-string cm-property">"status"</span>:<span class="cm-number">0</span>,</span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span
                class="cm-string cm-property">"msg"</span>:<span class="cm-string">"提示信息"</span>,</span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span
                class="cm-string cm-property">"data"</span>:<span class="cm-string">"返回数据，可能是对象，也可能是对象数组，也可能是字符串，也可能是数字。这部分由客户端与服务器协商后自行解析。"</span></span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;</span></pre><pre
                class=" CodeMirror-line " role="presentation"><span role="presentation"
                                                                    style="padding-right: 0.1px;">}</span></pre></div></div></div></div></div><div
                style="position: absolute; height: 30px; width: 1px; border-bottom-width: 0px; border-bottom-style: solid; border-bottom-color: transparent; top: 176px;"></div><div
                class="CodeMirror-gutters" style="display: none; height: 206px;"></div></div></div></pre>

        <div class="layui-elem-quote">
            <p>自然语言处理与可视化平台 - 林晓民</p>
        </div>

    </div>

        <jsp:include page="nav.jsp"></jsp:include>

    <jsp:include page="/static/common/footer.jsp"></jsp:include>
    <jsp:include page="/static/common/scripts.jsp"></jsp:include>
    <script src="/static/layui/js/doc/doc.js"></script>
</body>
</html>
